package net.xiduth.game.player.content;


import net.xiduth.cache.loaders.ItemDefinitions;
import net.xiduth.game.player.Player;
import net.xiduth.game.player.Skills;


public class ExpLamps {

	
	public enum Lamps {
		
		Attack(2500, 5000, 7500, 10000),
		Defence(2500, 5000, 7500, 10000),
		Strength(2500, 5000, 7500, 10000),
		Constitution(2500, 5000, 7500, 10000),
		Ranged(2500, 5000, 7500, 10000),
		Prayer(2500, 5000, 7500, 10000),
		Magic(2500, 5000, 7500, 10000),
		Cooking(2500, 5000, 7500, 10000),
		Woodcutting(2500, 5000, 7500, 10000),
		Fletching(2500, 5000, 7500, 10000),
		Fishing(2500, 5000, 7500, 10000),
		Firemaking(2500, 5000, 7500, 10000),
		Crafting(2500, 5000, 7500, 10000),
		Smithing(2500, 5000, 7500, 10000),
		Mining(2500, 5000, 7500, 10000),
		Herblore(2500, 5000, 7500, 10000),
		Agility(2500, 5000, 7500, 10000),
		Thieving(2500, 5000, 7500, 10000),
		Slayer(2500, 5000, 7500, 10000),
		Farming(2500, 5000, 7500, 10000),
		Runecrafting(2500, 5000, 7500, 10000),
		Hunter(2500, 5000, 7500, 10000),
		Construction(2500, 5000, 7500, 10000),
		Summoning(2500, 5000, 7500, 10000),
		Dungeoneering(2500, 5000, 7500, 10000);
		
		private int exp_small, exp_med, exp_large, exp_huge;
		
		Lamps(int expSmall, int expMed, int expLarge, int expHuge) {
			this.exp_small = expSmall;
			this.exp_med = expMed;
			this.exp_large = expLarge;
			this.exp_huge = expHuge;
		}
	}
	
	public static boolean rubLamp(Player player, int itemId) {
		ItemDefinitions def = ItemDefinitions.getItemDefinitions(itemId);
		String name = def.getName().toLowerCase();
		for (Lamps lamp : Lamps.values()) {
			String skillName = Skills.SKILL_NAME[lamp.ordinal()].toLowerCase();
			if (name.contains(skillName)) {
				if (name.contains("small")) {
					player.getSkills().addXp(lamp.ordinal(), lamp.exp_small);
					player.getInventory().deleteItem(itemId, 1);
					player.sendMessage("You have claimed a Small Lamp of "+skillName+" experience!");
					return true;
				} else if (name.contains("medium")) {
					player.getSkills().addXp(lamp.ordinal(), lamp.exp_med);
					player.getInventory().deleteItem(itemId, 1);
					player.sendMessage("You have claimed a Medium Lamp of "+skillName+" experience!");
					return true;
				} else if (name.contains("large")) {
					player.getSkills().addXp(lamp.ordinal(), lamp.exp_large);
					player.getInventory().deleteItem(itemId, 1);
					player.sendMessage("You have claimed a Large Lamp of "+skillName+" experience!");
					return true;
				} else if (name.contains("huge")) {
					player.getSkills().addXp(lamp.ordinal(), lamp.exp_huge);
					player.getInventory().deleteItem(itemId, 1);
					player.sendMessage("You have claimed a Huge Lamp of "+skillName+" experience!");
					return true;
				}
				return false;
			}
		}
		return false;
	}
}